<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateDrivingTariffTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('driving_tariff', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('company_id')->nullable()->comment('公司ID');
            $table->enum('type',[1,2])->default(1)->index()->comment('类型：1-乘客，2-司机');
            $table->bigInteger('service_type_id')->comment('业务类型ID');
            $table->string('name',50)->comment('资费名称');
            $table->enum('rules',[0,1])->default(0)->comment('收费规则模式 0日常代驾 1 暂无');
            $table->timestamp('open_time')->nullable()->comment('启用时间');
            $table->json('starting_price')->comment('起步价');
            $table->json('mileage')->comment('里程费');
            $table->json('waiting_timeout')->comment('等候费');
            $table->json('other_settings')->comment('其他设置');
            $table->bigInteger('creator_id')->comment('创建者ID');
            $table->bigInteger('modifier_id')->nullable()->comment('修改人ID');
            $table->softDeletes();
            $table->timestamps();
        });
        DB::statement("ALTER TABLE `driving_tariff` comment '代驾资费表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('driving_tariff');
    }
}
